# -*- coding: utf-8 -*- 
# @project : 《剑指offer》
# @Author : created by bensonrachel on 2021/6/20
# @File : 调整数组顺序使奇数位于偶数前面.py
class Solution(object):
    def reOrderArray(self, array):
        """
        :type array: List[int]
        :rtype: void
        """
        # 快排思想，执行一轮快排即可。
        l = 0
        r = len(array) - 1
        while (l < r):#终止条件为l==r
            while (l < r and array[l] % 2 != 0): l += 1
            while (l < r and array[r] % 2 == 0): r -= 1
            if (l < r): array[l], array[r] = array[r], array[l]

